import lombok.Getter;
import lombok.Setter;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

@Getter
@Setter
public class Visit extends Voter {
    private Integer station;
    private Date time;

    public Visit(String name, String birthDay) throws ParseException {
        super(name, new SimpleDateFormat("yyyy.MM.dd").parse(birthDay));

        if (name == null || name.isBlank()) {
            throw new ParseException("No name found", 0);
        }
    }

    public void parseTime(String time) throws ParseException {
        setTime(new SimpleDateFormat("yyyy.MM.dd HH:mm:ss").parse(time));
    }
}
